package com.taxshare.gateway.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
@ConfigurationProperties(prefix = "zuul")
public class GateConfig {

    /**
     * 白名单
     */
    private static String startWith;

    /**
     * 前缀
     */
    private static String prefix;

    private static Object lock = new Object();

    /**
     * 地址列表
     */
    private static String[] uri;

    public static String getStartWith() {
            return startWith;
    }

    public void setStartWith(String startWith) {
        synchronized (lock) {
            GateConfig.startWith = startWith;
            if (uri == null) {
                uri = startWith.split(",");
            }
        }
    }

    public static String getPrefix() {
        return prefix;
    }

    public void setPrefix(String prefix) {
        synchronized (lock) {
            GateConfig.prefix = prefix;
        }
    }

    public static String[] getUri() {
        return uri;
    }

}
